package com.bbcare.followup.plat.controller;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bbcare.comm.ResultModel;
import com.bbcare.followup.plat.service.IStatService;


/**
 * 统计大屏。
 */
@Controller
@RequestMapping("/service/stat")
public class StatController {
    private final static Logger logger = Logger.getLogger(StatController.class);

    @Autowired
    private IStatService statService;


    @ResponseBody
    @PostMapping("/center")
    public ResultModel<Map> center(@RequestBody String arg, HttpServletRequest request) throws Exception {
        logger.info("++++center() arg:" + arg);

        Map<String,Object> paraMap  = new HashMap<>();
        return new ResultModel<Map>(statService.center(paraMap));
    }

    @ResponseBody
    @PostMapping("/bottom")
    public ResultModel<Map> bottom(@RequestBody String arg, HttpServletRequest request) throws Exception {
        logger.info("++++bottom() arg:" + arg);

        Map<String,Object> paraMap  = new HashMap<>();
        return new ResultModel<Map>(statService.bottom(paraMap));
    }

    @ResponseBody
    @PostMapping("/left")
    public ResultModel<Map> left(@RequestBody String arg, HttpServletRequest request) throws Exception {
        logger.info("++++left() arg:" + arg);

        Map<String,Object> paraMap  = new HashMap<>();
        return new ResultModel<Map>(statService.left(paraMap));
    }

    @ResponseBody
    @PostMapping("/right")
    public ResultModel<Map> right(@RequestBody String arg, HttpServletRequest request) throws Exception {
        logger.info("++++right() arg:" + arg);

        Map<String,Object> paraMap  = new HashMap<>();
        return new ResultModel<Map>(statService.right(paraMap));
    }
}
